package nieAS.html {
	import flash.external.ExternalInterface;
	import nieAS.utils.Tracer;
	
	public class Share {
		
		public static function sinaShare(_title:String, _pic:String = null, _url:String = null, _video:String = null):void {
			var _shareStr:String = "http://service.weibo.com/share/share.php?c=nie&content=gb2312&source=nie";
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pic=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			} else if (_url != null) {
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			//if (js.getBrowserType().indexOf("msie") != -1) {
			Tracer.Trace(js.getBrowserType());
			Navigate.getURL(_shareStr);
			//}else {
				//ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
			//}
		}
		
		public static function qqShare(_title:String, _pic:String = null, _url:String = null, _video:String = null):void {
			var _shareStr:String = "http://share.v.t.qq.com/index.php?c=share&a=index";
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pic=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			} else if (_url != null) {
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			//if (js.getBrowserType().indexOf("msie") != -1) {
			Tracer.Trace(js.getBrowserType());
			Navigate.getURL(_shareStr);
			//}else {
				//ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
			//}
		}
		
		public static function qzoneShare(_title:String, _pic:String = null, _url:String = null, _video:String = null):void {
			var _shareStr:String = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey";
			var _source:String = ExternalInterface.call("encodeURIComponent", "网易游戏");
			_shareStr = _shareStr.concat("?summary=" + _source);
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pics=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			} else if (_url != null) {
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			//if (js.getBrowserType().indexOf("msie") != -1) {
			Tracer.Trace(js.getBrowserType());
			Navigate.getURL(_shareStr);
			//}else {
				//ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
			//}
		}
		
		public static function wyShare(_title:String, _pic:String = null, _url:String = null, _video:String = null):void {
			var _shareStr:String = "http://t.163.com/article/user/checkLogin.do?check1stImg=true&togImg=true&key=OELT16LMxo0rAmtO";
			var _source:String = ExternalInterface.call("encodeURIComponent", "网易游戏");
			_shareStr = _shareStr.concat("&source=" + _source);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&images=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&link=" + _video);
			} else if (_url != null) {
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&link=" + _url);
			}
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&info=" + _title + _url);
			//if (js.getBrowserType().indexOf("msie") != -1) {
			Tracer.Trace(js.getBrowserType());
			Navigate.getURL(_shareStr);
			//}else {
				//ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
			//}
		}
	}
}